package com.neusoft.ch6.demo3;

public class Person {

	// 属性（成员变量）
	// 姓名属性
	private String perName;
	// 性别
	private String perSex;
	// 年龄
	private int perAge;
	// 身份证号
	private String perCardId;

	// 行为（成员方法）
	/**
	 * 睡觉行为
	 */
	public void doSleeping() {
		System.out.println(this.perName + " is sleeping...");
	}

	/**
	 * 工作行为
	 */
	public void doWorking() {
		System.out.println("I am Working...");
	}

	/**
	 * 吃饭行为
	 */
	public void doEating() {
		System.out.println("I am eating...");
	}
	////////////////////////////
	public Person() {
		System.out.println("调用了父类Person类的默认构造方法");
	}

	public Person(String perName, String perSex) {
		super();
		this.perName = perName;
		this.perSex = perSex;
		System.out.println("调用了父类Person类的2个参数的构造方法");
	}
	
	
	
	public Person(String perName, String perSex, int perAge, String perCardId) {
		//构造方法之间可以通过 this(参数列表)的形式相互调用，但是this(参数列表)语句只能写在第一行；   
		this(perName, perSex);
		System.out.println("使用this调用本类的构造方法：");
		//super();
		
		this.perAge = perAge;
		this.perCardId = perCardId;
		System.out.println("调用了父类Person类的4个参数的构造方法");
	}

	public String getPerName() {
		return perName;
	}


	public void setPerName(String perName) {
		this.perName = perName;
	}

	public String getPerSex() {
		return perSex;
	}

	public void setPerSex(String perSex) {
		this.perSex = perSex;
	}

	public int getPerAge() {
		return perAge;
	}

	public void setPerAge(int perAge) {
		this.perAge = perAge;
	}

	public String getPerCardId() {
		return perCardId;
	}

	public void setPerCardId(String perCardId) {
		this.perCardId = perCardId;
	}


}
